本文整理匯總了Java中com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的典型用法代碼示例。如果您正苦於以下問題:Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的具體用法?Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue怎麽用?Java SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.microsoft.azure.storage.core.SharedAccessSignatureHelper
的用法示例。
在下文中一共展示了SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的package包/類
/**
* Returns a shared access signature for the queue.
*
* @param policy
* The access policy for the shared access signature.
* @param groupPolicyIdentifier
* A queue-level access policy.
* @return A shared access signature for the queue.
* @throws InvalidKeyException
* If an invalid key was passed.
* @throws StorageException
* If a storage service error occurred.
* @throws IllegalArgumentException
* If an unexpected value is passed.
*/
public String generateSharedAccessSignature(final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
throw new IllegalArgumentException(errorMessage);
}
final String resourceName = this.getSharedAccessCanonicalName();
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(policy,
groupPolicyIdentifier, resourceName, this.queueServiceClient, null);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(policy,
groupPolicyIdentifier, signature);
return builder.toString();
}
示例2: generateSharedAccessSignature
import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的package包/類
/**
* Returns a shared access signature for the queue.
*
* @param policy
* The access policy for the shared access signature.
* @param groupPolicyIdentifier
* A queue-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 shared access signature for the queue.
*
* @throws InvalidKeyException
* If an invalid key was passed.
* @throws StorageException
* If a storage service error occurred.
* @throws IllegalArgumentException
* If an unexpected value is passed.
*/
public String generateSharedAccessSignature(
final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
final SharedAccessProtocols protocols)
throws InvalidKeyException, StorageException {
if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
throw new IllegalArgumentException(errorMessage);
}
final String resourceName = this.getSharedAccessCanonicalName();
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(
policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient);
final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(
policy, groupPolicyIdentifier, ipRange, protocols, signature);
return builder.toString();
}